
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


enum OrderStatus {
    CREATE, PAID, SHIPPING, DELIVERED, CANCEL
}


enum PaymentType {
    CREDIT, CASH, WIRE_TRANSFER, ALIPAY, WEIXIN_PAY
}


abstract class Payment {
    protected double amount;

    public double getAmount() {
        return amount;
    }
}


class Credit extends Payment {
    private String number;
    private String type;
    private Date expireDate;

    public Credit(double amount, String number, String type, Date expireDate) {
        this.amount = amount;
        this.number = number;
        this.type = type;
        this.expireDate = expireDate;
    }
}


class Cash extends Payment {
    private double cashTendered;

    public Cash(double amount, double cashTendered) {
        this.amount = amount;
        this.cashTendered = cashTendered;
    }
}


class WireTransfer extends Payment {
    private String bankID;
    private String bankName;

    public WireTransfer(double amount, String bankID, String bankName) {
        this.amount = amount;
        this.bankID = bankID;
        this.bankName = bankName;
    }
}


class AliPay extends Payment {
    private String number;

    public AliPay(double amount, String number) {
        this.amount = amount;
        this.number = number;
    }
}


class WeixinPay extends Payment {
    private String number;

    public WeixinPay(double amount, String number) {
        this.amount = amount;
        this.number = number;
    }
}


class Customer {
    private String name;
    private String contact;
    private String deliveryAddress;
    private boolean active;
    private List<Order> orders = new ArrayList<>();

    public Customer(String name, String contact, String deliveryAddress, boolean active) {
        this.name = name;
        this.contact = contact;
        this.deliveryAddress = deliveryAddress;
        this.active = active;
    }

    public void addOrder(Order order) {
        orders.add(order);
    }

    // Getters and setters
    public String getName() { return name; }
    public String getContact() { return contact; }
    public String getDeliveryAddress() { return deliveryAddress; }
    public boolean isActive() { return active; }
    public List<Order> getOrders() { return new ArrayList<>(orders); }
}


class Product {
    private String title;
    private double weight;
    private String description;

    public Product(String title, double weight, String description) {
        this.title = title;
        this.weight = weight;
        this.description = description;
    }

    public double getPriceForQuantity(int quantity) {

        return quantity * 10.0; 
    }

    public double getWeight() {
        return weight;
    }


    public String getTitle() { return title; }
    public String getDescription() { return description; }
}


class OrderDetail {
    private Product product;
    private int quantity;

    public OrderDetail(Product product, int quantity) {
        this.product = product;
        this.quantity = quantity;
    }

    public double calculateSubTotal() {
        return product.getPriceForQuantity(quantity);
    }


    public double calculateWeight() {
        return product.getWeight() * quantity;
    }


    public Product getProduct() { return product; }
    public int getQuantity() { return quantity; }
}


class Order {
    private Date createDate;
    private OrderStatus status;
    private List<OrderDetail> orderDetails = new ArrayList<>();
    private Payment payment;

    public Order(Date createDate) {
        this.createDate = createDate;
        this.status = OrderStatus.CREATE; 
    }

    public void addOrderDetail(OrderDetail detail) {
        orderDetails.add(detail);
    }

    public void setPayment(Payment payment) {
        this.payment = payment;
    }

    // Getters and setters
    public Date getCreateDate() { return createDate; }
    public OrderStatus getStatus() { return status; }
    public void setStatus(OrderStatus status) { this.status = status; }
    public List<OrderDetail> getOrderDetails() { return new ArrayList<>(orderDetails); }
    public Payment getPayment() { return payment; }
}

public class OnlineShoppingSystem {
    public static void main(String[] args) {

        Customer customer = new Customer("张威", "13800138000", "北京市朝阳区", true);
        

        Product laptop = new Product("笔记本电脑", 2.6, "能最新款笔记本电脑");
        Product phone = new Product("智能手表", 0.3, "高性智能手表");
        

        Order order = new Order(new Date());
        

        order.addOrderDetail(new OrderDetail(laptop, 1));
        order.addOrderDetail(new OrderDetail(phone, 2));
        

        order.setPayment(new Credit(10000.0, "1234-5678-9012-3456", "Visa", new Date()));
        

        customer.addOrder(order);
        

        System.out.println("客户: " + customer.getName());
        System.out.println("订单创建日期: " + order.getCreateDate());
        System.out.println("订单状态: " + order.getStatus());
        System.out.println("订单总额: " + calculateOrderTotal(order));
        System.out.println("订单总重量: " + calculateOrderWeight(order));
    }
    

    private static double calculateOrderTotal(Order order) {
        double total = 0.0;
        for (OrderDetail detail : order.getOrderDetails()) {
            total += detail.calculateSubTotal();
        }
        return total;
    }
    

    private static double calculateOrderWeight(Order order) {
        double weight = 0.0;
        for (OrderDetail detail : order.getOrderDetails()) {
            weight += detail.calculateWeight();
        }
        return weight;
    }
}
